package model.config;


import model.User.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author success
 * @version 1.0
 * @description:本类用来演示:拓展springmvc的功能
 * springboot2.x中实现WebMvcConfigurer
 * @date 2019/6/27 0027
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer{

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自定义的拦截器的组件
        //排除路径的时候不需要加上content-path的路径值

        registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/user").excludePathPatterns("/reg").excludePathPatterns("/c").excludePathPatterns("/password").excludePathPatterns("/index");
    }
}
